export const enumeratFn = {
  getEnumerationName: (type, code) => {
    const list = enumeration[type] || []
    const item = list.find(v => v.code == code)
    return item ? item.name : ''
  },
  getEnumerationkey: (type, name) => {
    const list = enumeration[type] || []
    const item = list.find(v => v.name == name)
    return item ? item.code : ''
  },
  getEnumerationList: (v) => {
    return enumeration[v] || []
  },
  // 获取枚举项
  getEnumerationItem(type, code) {
    var obj = {}
    enumeration[type].forEach((item, index) => {
      if (item.code == code) {
        obj = { ...item, index: index }
      }
    });
    return obj
  }
}
const enumeration = {
  order_status: [
    { name: '全部', code: '' },
    { name: '待付款', code: '10' },
    { name: '客服处理中', code: '20' },
    { name: '待配货', code: '30' },
    { name: '待出库', code: '40' },
    { name: '待发货', code: '50' },
    { name: '待收货', code: '60' },
    { name: '已收货待结算', code: '70' },
    { name: '订单成功', code: '80' },
    { name: '已取消', code: '100' },
    { name: '订单关闭', code: '110' },
  ],
  // 意见反馈问题类型

  questionType: [
    { code: 10, name: '功能问题' },
    { code: 20, name: '商品问题' },
    { code: 30, name: '物流问题' },
    { code: 40, name: '服务问题' },
    { code: 50, name: '其他问题' },
    { code: 60, name: '服务态度' },
    { code: 70, name: '业务(回复)处理不及时' },
    { code: 80, name: '开错票' },
    { code: 90, name: '提错货' },
    { code: 100, name: '漏装货' },
    { code: 110, name: '发错货' },
    { code: 120, name: '沟通不到位' },
    { code: 130, name: '其他原因' },
  ],
  // 反馈类型
  freebackType: [
    { code: 10, name: '意见反馈' },
    { code: 20, name: '我要投诉' },
  ]

}